home *** CD-ROM | disk | FTP | other *** search
/ C# & Game Programming - A…er's Guide (2nd Edition) / Buono 2nd Ed.iso / Chapter5 / 5.53 / 5.53.cs next >
Text File  |  2004-09-07  |  572b  |  22 lines

  1. /* Fixed pointers. */
  2. using System;
  3.  
  4. namespace Chapter5 {
  5.     class ClassFixed {
  6.         public int variable;
  7.     }
  8.  
  9.     class Class1 {
  10.         static unsafe void Main () {
  11.             ClassFixed TestFixed = new ClassFixed();
  12.  
  13.             Console.Write("Enter a number: ");
  14.             TestFixed.variable = int.Parse(Console.ReadLine());   
  15.   
  16.             fixed (int* pointer = &TestFixed.variable) { 
  17.                 Console.WriteLine("\n{0}", TestFixed.variable);
  18.                 Console.WriteLine("\n{0}", *pointer);
  19.             }
  20.         }
  21.     }
  22. }